Date Rollups in Dives
Date-rollup functionality is available in the Spectre engine. It allow users to dive on a date column as if it were a period column by providing (on a Dive window's dimension tag) extra information that describes the desired period type and calendar in use. Spectre behaves as if it had converted each value in the table to the period type, and then dived on the resulting column. An error is issued and <unknown> is returned for the resulting period for any date outside of the calendar's range.
The syntax is:
dimension "<name_of_rolled_column>" { date-rollup "<name_of_unrolled_source_column>" calendar="<calendar name>" period-type="<period type>" }
This is equivalent to:
// in the input: column "<name_of_unrolled_source_column>" type="date" add "<name_of_rolled_column>" ``` period(<calendar>, <period-type>, value("<name_of_rolled_column>")) ``` // in the dive: dimension "<name_of_rolled_column>"
For example, using the standard calendar:
dimension "Year-Month" { date-rollup "date" calendar="standard" period-type="year-month" }
For example, using the built-in ISO calendar:
dimension "Week" { date-rollup "date" calendar="iso 8601" period-type="year-week" }
For example, using a custom calendar:
dimension "Era" { date-rollup "date" calendar="eras" period-type="year" }